import { defineComponent } from "vue";
import { EffectType } from "../../../enums/messageEnum";
import "./status.scss";
export default defineComponent({
	props: {
		modelValue: [String, Boolean, Number],
		/**
		 * 显示内容
		 * labels={'running':'运行中','stopped':'已停止'}
		 * labels={'online':'在线','offline':'离线'}
		 */
		labels: {
			type: Object,
			default() {
				return {};
			}
		},
		/**
		 * 显示类型
		 * types={'running':'success','stopped':'danger'}
		 * labels={'online':'success','offline':'error'}
		 */
		types: {
			type: Object,
			default() {
				return {} as any;
			}
		},
		onlineLabel: {
			type: String,
			default() {
				return "在线";
			}
		},
		offlineLabel: {
			type: String,
			default() {
				return "离线";
			}
		}
	},
	emits: [],
	setup(props) {
		return () => {
			return props.modelValue == true ? (
				<el-tag type={props.types?.[props.modelValue + ""] || EffectType.success} size="default">
					<span>{props.labels?.[props.modelValue + ""] || props.onlineLabel}</span>
				</el-tag>
			) : (
				<el-tag type={props.types?.[props.modelValue as string] || EffectType.danger} size="default">
					<span>{props.labels[props.modelValue as string] || props.onlineLabel}</span>
				</el-tag>
			);
		};
	}
});
